<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<style>
<!--
#ciSelectorCiIdMsg {
	display: none
}
-->
</style>

<script type="text/javascript">
<!--
	var ciAfterSelectecd = function(id, name, item) {
		$("#ciName").val(name);
		$("#code").val(item.code);
	}
//-->
</script>
<form:form commandName="model" cssClass="validate" id="form1"
	action="task/inspectTemplate/save">
	<form:hidden path="id" />
	<form:hidden path="defId" />
	<form:hidden path="code" />
	<div class="header">
		<h3>基本信息</h3>
	</div>
	<table class=" form-table">
		<tbody>
			<tr>
				<td class="td1">父级：</td>
				<td class="td2"><form:input path="parentId" cssClass="hidden" />
					<isperp:treeSelector id="selectParentinspectTemplate"
						url="task/inspectTemplate/getTree" valueControlId="parentId"
						displayValue="${parentName}" displayValueCssClass="required"></isperp:treeSelector>
				</td>
			</tr>


			<tr>
				<td class="td1">名称：</td>
				<td class="td2"><form:input path="name" cssClass="required" />
				</td>
			</tr>

			<tr>
				<td class="td1">是否展开：</td>
				<td class="td2"><form:checkbox path="open" />
				</td>
			</tr>
			<tr>
				<td class="td1">排序：</td>
				<td class="td2"><form:input path="orderNum" cssClass="number" />
				</td>
			</tr>
		</tbody>
	</table>
	<div class="header">
		<h3>选择资产并设置巡检项</h3>
	</div>

	<table class=" form-table">
		<tbody>
			<tr>
				<td class="td1">巡检资产：</td>
				<td class="td2"><form:hidden path="ciId" /> <form:input
						path="ciName" cssClass="required" value="${model.ciName }" /> <isperp:ciSelector
						id="ciSelector" valueControlId="ciId"
						afterSelected="ciAfterSelectecd"></isperp:ciSelector>
				</td>
			</tr>
		</tbody>
	</table>
</form:form>

<div style="padding:5px;text-align: right">

	<isperp:toolbar id="inspectTemplateCheckToolbar">
		<isperp:button id="inspectTemplateCheckCreate" icon="icon-plus"
			text="新增巡检项定义 " cssClass="nui-mainbtn" onclick="newTemplate();"></isperp:button>

	</isperp:toolbar>
</div>

<isperp:grid url="task/inspectTemplateCheck/list"
	cusDeleteUrl="task/inspectTemplateCheck/delete" sortname="order_num"
	gridId="inspectTemplateCheckGrid" showPager="false" height="auto"
	showToolbar="false"
	urlExtScript="function (){return '?templateId=${model.id }'}"
	ondbClickRowEvent="inspectTemplateCheckGrid.edit(rowid);"
	cusEditUrl="task/inspectTemplateCheck/edit">


	<jsp:body>
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	 
	<isperp:column name="checkName" title="名称" width="100">
	</isperp:column>
	 
	<isperp:column name="checkUnit" title="单位" width="60">
	</isperp:column>
	 
	<isperp:column name="dataType" title="类型" width="80">
	</isperp:column>
	  
	<isperp:column name="notnull" title="必填" width="50">
	</isperp:column>
	 
	<isperp:column name="orderNum" title="排序" width="50">
	</isperp:column>
	 
	
	</jsp:body>
</isperp:grid>



<isperp:buttonList>
	<button class="submit" onclick="isperp.submitForm(); return false;">
		<span class="icon icon-save"></span>提交
	</button>
</isperp:buttonList>

<script type="text/javascript">
	function newTemplate() {
		//先保存表单
		try {
			var vr = $("#form1").valid();
			if (vr) {
				isperp.submitForm({
					isValidate : true,
					isCloseDialog : false,
					success : function() {
						inspectTemplateCheckGrid
								.create('templateId=${model.id}');
					}
				});
			}

		} catch (e) {
		}

	}
</script>
